
<template >
  <div>
    <modaltemplate v-if="ctcount&&tzcount&&areaflag" :tzcount="tzcount" :ctcount="ctcount" :areaflag='areaflag'>
      <template v-slot:changtai="slotProps">
        <commonbox :itemlists="data[slotProps.menuitem]" :getRegion='getRegion' :getSensor='getSensor' v-if="data[slotProps.menuitem]" />
      </template>

      <template v-slot:pie="slotProps">
        <pie v-if="dataitems" :dataitems="dataitems" />
      </template>

      <template v-slot:form="slotProps" v-if="fromsData.length>0">
        <forms class="right-b" :fromsData="fromsData"></forms>
      </template>
    </modaltemplate>
  </div>
</template>
<script lang="ts">
import modaltemplate from '@/components/modal.vue'
import commonbox from '@/components/commonbox.vue'
import pie from '@/components/pie.vue'
import { ref, reactive,defineComponent } from 'vue-demi'
import forms from '@/components/forms1.vue'
import {
  getJiaDingAPIfindAllCaseMsg, getJiaDingAPIfindChengshiMsg,
  getJiaDingAPIFindTypeAndDateNum,
  getSensor,
  getRegion,
  getRunState
} from "../api/home";

export default defineComponent({
    name: 'modaltest',
    components: {
        modaltemplate,
        commonbox,
        pie,
        forms,
    },
    props: {
        menuitem: Array,
    },

  setup(props) {
    const {dataitems, tzcount} = getJiaDingAPIFindTypeAndDateNum()
    const fromsData = getJiaDingAPIfindAllCaseMsg()
    const {data, ctcount} = getJiaDingAPIfindChengshiMsg()
    let areaflag = ref('')
    // 运行状态
    // let areaflag = ref('')
    getRunState().then((state) => {
      areaflag.value = state
    })
    return {
      data,
      dataitems,
      fromsData,
      tzcount,
      ctcount,
      areaflag,
      getRegion,
      getSensor
    }
  }
})
</script>
<style lang="less" scoped>
.test2 {
    color: red;
}

</style>